<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改交货路线')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${inventoryStatus}">
        <!--<input id="rowkey" name="rowkey" type="hidden" th:field="*{rowkey}"/>-->

        <div class="form-group">
            <label class="col-sm-3 control-label ">主键：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" disabled name="rowkey" id="rowkey" th:field="*{rowkey}" required  >
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">partStatus：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="partStatus" id="partStatus" th:field="*{partStatus}" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">description：</label>
            <div class="col-sm-8">
                <input id="description" name="description" class="form-control" th:field="*{description}" type="text" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">demandFlag：</label>
            <div class="col-sm-8">
                <select name="demandFlag" th:with="type=${@dict.getType('sys_yes_no')}">
                    <option value=""  th:value="*{demandFlag}" th:text="*{demandFlag}">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">onhandFlag：</label>
            <div class="col-sm-8">
                <select name="onhandFlag" th:with="type=${@dict.getType('sys_yes_no')}">
                    <option value=""  th:value="*{onhandFlag}" th:text="*{onhandFlag}">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">supplyFlag：</label>
            <div class="col-sm-8">
                <select name="supplyFlag" th:with="type=${@dict.getType('sys_yes_no')}">
                    <option value=""  th:value="*{supplyFlag}" th:text="*{supplyFlag}">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">defaultStatus：</label>
            <div class="col-sm-8">
                <label class="toggle-switch switch-solid">
                    <input type="checkbox" id="defaultStatus" th:checked="${inventoryStatus.defaultStatus == 'TRUE' ? true : false}" checked>
                    <span></span>
                </label>
            </div>
        </div>



    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">
    
    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }

    function edit() {
        var rowkey = $("input[name='rowkey']").val();
        var partStatus = $("input[name='partStatus']").val();
        var description = $("input[name='description']").val();
        var demandFlag = $("select[name='demandFlag']").val();
        var onhandFlag = $("select[name='onhandFlag']").val();
        var supplyFlag = $("select[name='supplyFlag']").val();
        var defaultStatus = $("input[id='defaultStatus']").is(':checked') == true ? 'TRUE': 'FALSE';

        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "inventoryStatuses/edit",
            data : {
                "rowkey": rowkey,
                "partStatus":partStatus,
                "description":description,
                "demandFlag":demandFlag,
                "onhandFlag":onhandFlag,
                "supplyFlag":supplyFlag,
                "defaultStatus":defaultStatus,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
    
    
</script>
</body>
</html>
